<?php
$this->set_css($this->default_theme_path.'/twitter-bootstrap/css/bootstrap.min.css');
$this->set_css($this->default_theme_path.'/twitter-bootstrap/css/bootstrap-responsive.min.css');
$this->set_css($this->default_theme_path.'/twitter-bootstrap/css/style.css');
$this->set_css($this->default_theme_path.'/twitter-bootstrap/css/jquery-ui/flick/jquery-ui-1.9.2.custom.css');
$this->set_js_lib($this->default_javascript_path.'/'.grocery_CRUD::JQUERY);
$this->set_js($this->default_theme_path.'/twitter-bootstrap/js/jquery-ui/jquery-ui-1.9.2.custom.js');
$this->set_js_lib($this->default_javascript_path.'/common/lazyload-min.js');

if (!$this->is_IE7()) {
	$this->set_js_lib($this->default_javascript_path.'/common/list.js');
}

$this->set_js($this->default_theme_path.'/twitter-bootstrap/js/libs/bootstrap/bootstrap.min.js');
$this->set_js($this->default_theme_path.'/twitter-bootstrap/js/libs/bootstrap/application.js');
$this->set_js($this->default_theme_path.'/twitter-bootstrap/js/libs/modernizr/modernizr-2.6.1.custom.js');
$this->set_js($this->default_theme_path.'/twitter-bootstrap/js/libs/tablesorter/jquery.tablesorter.min.js');
$this->set_js($this->default_theme_path.'/twitter-bootstrap/js/cookies.js');
$this->set_js($this->default_theme_path.'/twitter-bootstrap/js/jquery.form.js');
$this->set_js($this->default_javascript_path.'/jquery_plugins/jquery.numeric.min.js');
$this->set_js($this->default_theme_path.'/twitter-bootstrap/js/libs/print-element/jquery.printElement.min.js');
$this->set_js($this->default_javascript_path.'/jquery_plugins/jquery.fancybox-1.3.4.js');
$this->set_js($this->default_javascript_path.'/jquery_plugins/jquery.easing-1.3.pack.js');

//	JAVASCRIPTS - JQUERY UI
//$this->set_js_lib($this->default_javascript_path.'/jquery_plugins/ui/'.grocery_CRUD::JQUERY_UI_JS);
//$this->load_js_jqueryui();

$this->set_js($this->default_theme_path.'/twitter-bootstrap/js/app/twitter-bootstrap-edit.js');
$this->set_js($this->default_theme_path.'/twitter-bootstrap/js/jquery.functions.js');
?>
<div class="twitter-bootstrap crud-form">
	<div id="message-box" class="span12"></div>
    <div id="main-table-box span12">
    
    <?php echo form_open( $update_url, 'method="post" id="crudForm" class="form-div span12" autocomplete="off" enctype="multipart/form-data"'); ?>
    <table class="table table-bordered tablesorter table-striped">
    	<tr>
        	<th colspan="2"><?php echo $this->l('list_record'); ?> <?php echo $subject?></th>
        </tr>
        <?php foreach($fields as $field): ?>
        <tr>
        	<td width="25%">
            	<?php echo $input_fields[$field->field_name]->display_as; ?>
				<?php echo ($input_fields[$field->field_name]->required)? '<span class="required">*</span>' : ""; ?>
            </td>
            <td width="75%"><?php echo $input_fields[$field->field_name]->input?></td>
        </tr>
        <?php endforeach; ?>
        
        <tr>
        	<td>&nbsp;</td>
            <td>
            	<input type="button" value="<?php echo $this->l('form_update_changes'); ?>"  class="btn btn-large btn-success submit-form"/>
                <?php 	if(!$this->unset_back_to_list) { ?>
				<input type="button" value="<?php echo $this->l('form_update_and_go_back'); ?>" id="save-and-go-back-button"  class="btn btn-large btn-info"/>
				<input type="button" value="<?php echo $this->l('form_cancel'); ?>" class="btn btn-large btn-warning return-to-list" />
                <input type='button' value='<?php echo $this->l('form_back_to_list'); ?>' class="btn btn-large back-to-list" id="cancel-button" />
			<?php 	} ?>
            &nbsp;&nbsp;&nbsp;<span class="hide loading" id="ajax-loading"><?php echo $this->l('form_update_loading'); ?></span>         
            </td>
        </tr>
        
    </table>
    <?php
		if( !empty($hidden_fields) ){
			foreach($hidden_fields as $hidden_field){
				echo $hidden_field->input;
			}
		}
	?>
    <?php echo form_close(); ?>
    
    </div>	
</div>
<script>
	var validation_url = "<?php echo $validation_url?>",
		list_url = "<?php echo $list_url?>",
		message_alert_edit_form = "<?php echo $this->l('alert_edit_form')?>",
		message_update_error = "<?php echo $this->l('update_error')?>";
</script>